﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;

using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Xml.Linq;

public partial class 数据访问控件_DataView_DetailsView实现添加修改删除 : System.Web.UI.Page
{
    Tong.TongUse1 TextData = new Tong.TongUse1();
    protected void Page_Load(object sender, EventArgs e)
    {
        for (int i = 0; i < 80; i++)
        {
            TextData.Add("晶", "sdfds");
        }
        Response.Write("条数:" + TextData.Length+"<br/>");
        TextData.Clear();
        Response.Write("请除后:" + TextData.Length + "<br/>");

        Response.Write(HttpUtility.UrlDecode(HttpUtility.UrlEncodeUnicode("实现添加修改删除")));

        DataSet Myds = new DataSet();
        // 设置连接对象
        Tong.TongSqlProcedure SqlProcedure = new Tong.TongSqlProcedure() { Procedure = "ShowTree" };
        SqlProcedure.SetInputValue("@parentId", 0);
        SqlProcedure.ExecuteAdapter().Fill(Myds);

        Response.Write(Myds.Tables[0].Rows.Count);

        //Response.Write("<br/>" + TextData.SqlataSet("select * from [TreeClass]").Tables[0].Rows.Count);
    }






    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
    {

    }
    protected void GridView1_SelectedIndexChanged1(object sender, EventArgs e)
    {

    }

    protected void DetailsView1_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
    {
        GridView1.DataSourceID = "Gridview";
        GridView1.DataBind();
    }
}

namespace Tong
{

    using System.Collections.Generic;
    using System.Data.SqlClient;
    using System.Data.Linq;
    using System.Xml;

    public partial class TongUse1:TongUse
    {
        /// <summary>
        /// 新建一个字段对象
        /// </summary>
        System.Collections.Generic.List<TabCoulmnAndValue> DataCloulm = new List<TabCoulmnAndValue>();

        public void Add(string coulmnName, string coulmnValue)
        {
            TabCoulmnAndValue TabCoulmnObj = new TabCoulmnAndValue();
            TabCoulmnObj.CoulmnName = coulmnName;//把得到的表的字段名给出来
            TabCoulmnObj.CoulmnValue = coulmnValue;//把对应字段的字段字值给出来
            DataCloulm.Add(TabCoulmnObj);
            length++; 
        }

        private int length=0;

        /// <summary>
        /// 类里字段字段总数
        /// </summary>
        public int Length
        {
            get { return length; }
        }

        /// <summary>
        /// 清除所有的对象
        /// </summary>
        public void Clear()
        {
            DataCloulm.Clear();
            length = DataCloulm.Count;
        }



        /// <summary>
        /// 执行操作
        /// </summary>
        public void ExecuteQuery()
        {
            System.Data.SqlClient.SqlCommand Cmd = new System.Data.SqlClient.SqlCommand();
            Cmd.CommandType = CommandType.Text;
        }

        /// <summary>
        /// 表的字段
        /// </summary>
        #region
        private class TabCoulmnAndValue
        {
            private string coulmnName;

            private string coulmnValue;


            /// <summary>
            /// 和字段对应的字段值
            /// </summary>
            public string CoulmnValue
            {
                get { return coulmnValue; }
                set { coulmnValue = value; }
            }

            /// <summary>
            /// 帮定的数据表的字段名
            /// </summary>
            public string CoulmnName
            {
                get { return coulmnName; }
                set { coulmnName = value; }
            }
        }
        #endregion
    }







}